package org.example.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class MyConfig {

    //注入RestTemplate
    @Bean
    @LoadBalanced //指定restTemplate通过负载均衡的方式进行调用
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
    //相当于<bean id="" class=""></bean>
}
